//
//  CommenConst.swift
//  QMXK
//
//  Created by jenkin on 2018/12/3.
//  Copyright © 2018年 jenkin. All rights reserved.
//

import UIKit



class CommenConst: NSObject {
    static let shareCommentConst:CommenConst = CommenConst.init()
    static let Krate:CGFloat = UIScreen.main.bounds.size.width / 375.0
    static let KWindow:UIWindow! = (UIApplication.shared.delegate as! AppDelegate).window
    static let KScreenW:CGFloat = UIScreen.main.bounds.size.width
    static let KScreenH:CGFloat = UIScreen.main.bounds.size.height
    static let KNAVH:CGFloat = shareCommentConst.KNAVH()
    static let KBottomH:CGFloat = shareCommentConst.KBottomH()
    static let rate:CGFloat = shareCommentConst.KSIZE(1)
    static var lineCellW:CGFloat{
        get{
            return CGFloat(ZZBaseUtil.shareUtil.getCellW())
        }
    }
    
    func KSIZE(_ size:CGFloat) -> CGFloat{
        return size * CommenConst.Krate;
    }
    
    func KNFONT(_ fontSize: CGFloat) -> UIFont{
        if #available(iOS 8.0, *){
            return UIFont.init(name: "PingFangSC-Regular", size: fontSize)!
        }
        return UIFont.init().withSize(fontSize)
        
    }
    
    public func KNAVH() -> CGFloat{
        if self.ISIPhoneX() == true{
         return 88.0
        }
        return 64.0
    }
    
    public func KBottomH() ->CGFloat{
        if self.ISIPhoneX() == true{
            return 83.0
        }
        return 49.0
    }
    
    func ISIPhoneX() ->Bool{
        var isX:Bool = false
        if UIDevice.current.userInterfaceIdiom != UIUserInterfaceIdiom.phone{
            return false;
        }
        
        if #available(iOS 11.0, *) {
            if(CommenConst.KWindow.safeAreaInsets.bottom > 0){
                isX = true
            }
        }
        return isX;
    }
}
